package com.example.myapp.players;

import com.example.myapp.models.Playable;
import com.example.myapp.utils.StateAnalysis;

import java.util.List;
import java.util.Random;

public class RandomSelectBot extends Bot implements Playable{
    @Override
    public int[] getNextStep(int[] stateMatrix, int faction) {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        List<int[]> capable = StateAnalysis.listCapablePoints(getGame(), faction);
        if (capable.size() < 1) {
            return new int[]{-1, -1};
        } else {
            return capable.get((new Random()).nextInt(capable.size()));
        }
    }

    public RandomSelectBot(int f) {
        this.setFaction(f);
    }
}
